www.gusucode.com > VC++ 特殊网址访问器源代码-源码程序 > VC++ 特殊网址访问器源代码-源码程序/code/Demo3/Demo03View.cpp

    // Demo03View.cpp : implementation of the CDemo03View class
// Download by http://www.NewXing.com

#include "stdafx.h"
#include "Demo03.h"

#include "Demo03Doc.h"
#include "Demo03View.h"

//增加 CMainFrame的引用声明
#include "MainFrm.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDemo03View

IMPLEMENT_DYNCREATE(CDemo03View, CHtmlView)

BEGIN_MESSAGE_MAP(CDemo03View, CHtmlView)
	//{{AFX_MSG_MAP(CDemo03View)
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CHtmlView::OnFilePrint)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDemo03View construction/destruction

CDemo03View::CDemo03View()
{
	// TODO: add construction code here

}

CDemo03View::~CDemo03View()
{
}

BOOL CDemo03View::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CHtmlView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CDemo03View drawing

void CDemo03View::OnDraw(CDC* pDC)
{
	CDemo03Doc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
}

void CDemo03View::OnInitialUpdate()
{
	CHtmlView::OnInitialUpdate();
	// 将CMainFrame的m_pHtmlView指针变量指向CDemo03View的实例
	CMainFrame * m_Frm = (CMainFrame *)::AfxGetMainWnd();
	m_Frm->m_pHtmlView = this;
	// TODO: This code navigates to a popular spot on the web.
	//  change the code to go where you'd like.
//	Navigate2(_T("http://www.microsoft.com/visualc/"),NULL,NULL);
//	Navigate2(_T("C:\\1.html"),NULL,NULL);
}

/////////////////////////////////////////////////////////////////////////////
// CDemo03View printing


/////////////////////////////////////////////////////////////////////////////
// CDemo03View diagnostics

#ifdef _DEBUG
void CDemo03View::AssertValid() const
{
	CHtmlView::AssertValid();
}

void CDemo03View::Dump(CDumpContext& dc) const
{
	CHtmlView::Dump(dc);
}

CDemo03Doc* CDemo03View::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CDemo03Doc)));
	return (CDemo03Doc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CDemo03View message handlers

void CDemo03View::GoUrl(CString strUrl)
{
	Navigate2(strUrl,NULL,NULL);
}